home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / dev / misc / ros_v2_1.lha / NonSystemStartupROS.s < prev    next >
Text File  |  1996-10-31  |  9KB  |  463 lines

  1. **
  2. **    $VER: NonSystemStartup.s 4.3 (01.11.96)
  3. **
  4. **    NonSystemStartup-Routine for Intros/Demos
  5. **    Needs RETIRE-Operating-System Includes & Library
  6. **    ASM-One V1.09 or later required
  7. **
  8. **    RETIRE Operating System (ROS) programmed by TIK/RETIRE
  9. **    Useful ideas and hints by TODI/RETIRE
  10. **    Thanks to PABLO/RETIRE for ROS beta testing
  11. **
  12. **    ROS included by TODI/RETIRE
  13. **
  14.  
  15. *------------------------------------------------------------------------------
  16.  
  17.     INCDIR    Include:
  18.  
  19.     INCLUDE    Exec/exec_lib.i
  20. ;    INCLUDE    Exec/memory.i
  21. ;    INCLUDE    Hardware/custom.i
  22. ;    INCLUDE    Hardware/cia.i
  23.     INCLUDE    intuition/intuition_lib.i
  24.     INCLUDE    Libraries/ros.i
  25.     INCLUDE    Libraries/ros_lib.i
  26.  
  27. *------------------------------------------------------------------------------
  28.  
  29. SourceTest    = 1            ; 1=YES/0=NO
  30. ROSVersion    = 1            ; required ros.library version
  31.  
  32. *------------------------------------------------------------------------------
  33. ; CPU and chipset options, uncomment if you need it
  34.  
  35. ;_CPUType    = AFB_68020        ; Set the CPU type you need
  36. ;_ChipSetType    = ROSCSB_AGA        ; Set the chipset (ECS or AGA) you need
  37.  
  38. _CacheBits    = CACRF_EnableI!CACRF_IBE!CACRF_EnableD!CACRF_DBE!CACRF_WriteAllocate!CACRF_CopyBack
  39. _CacheMask    = CACRF_EnableI!CACRF_IBE!CACRF_EnableD!CACRF_DBE!CACRF_WriteAllocate!CACRF_CopyBack
  40.  
  41. *------------------------------------------------------------------------------
  42. ; The Player 6.1A options
  43.  
  44. ;use        = -1        ; The Usecode, uncomment to use P61A player
  45.  
  46.     IFD     use
  47. opt020        = 0        ; 0 = MC680x0 code, 1 = MC68020+ or better
  48. ;start        = 6        ; Starting position, uncomment if you need
  49. fade        = 0        ; 0 = normal, 1 = use master volume
  50. CIA        = 1        ; 0 = disabled, 1 = enabled
  51. channels    = 4        ; amount of channels to be played
  52. jump        = 1        ; 0 = do NOT include position jump code
  53.     ENDC
  54.  
  55. *------------------------------------------------------------------------------
  56.  
  57.     printt    ""
  58.     printt    "Code options used:"
  59.     printt    "------------------"
  60.  
  61.     IFD    _CPUType
  62.     IF    _CPUType=AFB_68010
  63.     printt    "CPU: 68000"
  64.     ELSE
  65.     IF    _CPUType=AFB_68020
  66.     printt    "CPU: 68020"
  67.     ELSE
  68.     IF    _CPUType=AFB_68030
  69.     printt    "CPU: 68030"
  70.     ELSE
  71.     IF    _CPUType=AFB_68040
  72.     printt    "CPU: 68040"
  73.     ELSE
  74.     IF    _CPUType=AFB_68060
  75.     printt    "CPU: 68060"
  76.     ENDC
  77.     ENDC
  78.     ENDC
  79.     ENDC
  80.     ENDC
  81.     ELSE
  82.     printt    "CPU: no check"
  83.     ENDC
  84.  
  85.     IFD    _ChipSetType
  86.     IF    _ChipSetType=ROSCSB_AGA
  87.     printt    "ChipSet: AGA"
  88.     ELSE
  89.     printt    "ChipSet: ECS"
  90.     ENDC
  91.     ELSE
  92.     printt    "ChipSet: no check"
  93.     ENDC
  94.  
  95.     printt    ""
  96.  
  97. *------------------------------------------------------------------------------
  98. ;Screen constants
  99.  
  100. ScrWidth    = 40
  101. ScrHeight    = 256
  102. Scr        = ScrWidth*ScrHeight    ; Size of the screen
  103. Bpl        = 1            ; Number of BitPlanes
  104.  
  105.  
  106. *------------------------------------------------------------------------------
  107. ; The code
  108.  
  109.     SECTION    Code,CODE
  110.  
  111.     IFEQ SourceTest
  112.     INCLUDE    misc/easystart.i    ; Then the proggy runs from Workbench
  113.     ENDC
  114.     
  115. PrgStart:
  116.     moveq    #0,d0
  117.     lea    _IntName(pc),a1
  118.     CALLEXEC OpenLibrary
  119.     move.l    d0,_IntuitionBase
  120.     beq.w    .end
  121.  
  122.     moveq    #ROSVersion,d0
  123.     lea    _ROSName(pc),a1
  124.     jsr    _LVOOpenLibrary(a6)
  125.     move.l    d0,_ROSBase
  126.     bne.b    .libok
  127.  
  128.     moveq    #0,d0
  129.     moveq    #0,d1
  130.     move.w    #20*8+52,d2        ; req width
  131.     move.w    #1*10+50,d3        ; req height
  132.     sub.l    a0,a0
  133.     sub.l    a2,a2
  134.     lea    .body(pc),a1
  135.     lea    .neggad(pc),a3
  136.     move.l    _IntuitionBase(pc),a6
  137.     jsr    _LVOAutoRequest(a6)    ; error requester
  138.     bra.w    .closeint
  139.  
  140. .neggad    dc.b    0            ; FrontPen
  141.     dc.b    1            ; BackPen
  142.     dc.b    0            ; DrawMode
  143.     dc.b    0            ; Fill
  144.     dc.w    6            ; LeftEdge
  145.     dc.w    3            ; TopEdge
  146.     dc.l    0            ; No special font
  147.     dc.l    .gadtxt            ; Pointer to text
  148.     dc.l    0            ; No more text
  149.  
  150. .body    dc.b    0            ; FrontPen
  151.     dc.b    1            ; BackPen
  152.     dc.b    0            ; DrawMode
  153.     dc.b    0            ; Fill
  154.     dc.w    16            ; LeftEdge
  155.     dc.w    10            ; TopEdge
  156.     dc.l    0            ; No special font
  157.     dc.l    .txt1            ; Pointer to text
  158.     dc.l    0            ; No more text
  159.  
  160. .gadtxt    dc.b    "Abort",0
  161. .txt1    dc.b    "Can't open ros.library V",ROSVersion+"0",0
  162.     even
  163.  
  164.  
  165. *--------------------------------------
  166. .libok    move.l    _ROSBase(pc),a6
  167.  
  168.  
  169. *--------------------------------------
  170. ; set Caches
  171.  
  172.     move.l    #AllCaches,d0        ; cachebits
  173.     move.l    #AllCaches,d1        ; cachemask
  174.     jsr    _LVOROSSetCache(a6)
  175.  
  176. *--------------------------------------
  177. ; Hardware Check
  178.  
  179.     IFD    _CPUType
  180.     move.w    #_CPUType,d0
  181.     jsr    _LVOROSCPUCheck(a6)
  182.     tst.w    d0
  183.     beq.w    .closeROS
  184.     ENDC
  185.  
  186.     IFD    _ChipSetType
  187.     move.w    #_ChipSetType,d0
  188.     jsr    _LVOROSChipsetCheck(a6)    
  189.     tst.w    d0
  190.     beq.w    .closeROS
  191.     ENDC
  192.  
  193.     IFD    use
  194.     jsr    _LVOROSAllocAudio(a6)
  195.     tst.w    d0
  196.     beq.w    .closeROS
  197.     ENDC
  198.  
  199. *--------------------------------------
  200. ; Some initializings
  201.  
  202.     move.l    #Screen1,d0        ; Set plane pointers of Screen1
  203.     lea    CopBpl,a0
  204.     move.w    #Bpl-1,d1        ; # of planes
  205. .Loop1    move.w    d0,6(a0)
  206.     swap    d0
  207.     move.w    d0,2(a0)
  208.     swap    d0
  209.     addq.l    #8,a0
  210.     add.l    #Scr,d0
  211.     dbf    d1,.Loop1
  212.  
  213. *--------------------------------------
  214. ; set Playerinterrupt
  215.  
  216.     IFD    use
  217.     lea    P61_lev6server(pc),a0
  218.  
  219.     moveq    #INTB_CIABTIMA,d0
  220.     jsr    _LVOROSSetIntVec(a6)
  221.     tst.w    d0
  222.     beq.b    .timb
  223.     move.w    #INTF_CIABTIMA,d0
  224.     moveq    #0,d1            ; indicate timer a usage
  225.     bra.b    .ciaok
  226.  
  227. .timb    moveq    #INTB_CIABTIMB,d0
  228.     jsr    _LVOROSSetIntVec(a6)
  229.     tst.w    d0
  230.     beq.w    .freeaudio
  231.     move.w    #INTF_CIABTIMB,d0
  232.     moveq    #1,d1            ; indicate timer b usage
  233.  
  234. .ciaok    move.w    d0,_CiaIntFlag
  235.     move.w    d1,_CiaTimer
  236.     ENDC
  237.  
  238. *--------------------------------------
  239.  
  240.     lea    ExitHandler(pc),a0
  241.     jsr    _LVOROSSetExitHandler(a6)
  242.  
  243.  
  244.     moveq    #KILLF_DEATHMODE,d0
  245. ;    moveq    #KILLF_SYSMODE,d0
  246.     jsr    _LVOROSKillSystem(a6)
  247.     tst.w    d0
  248.     beq.w    .afterawake
  249.  
  250. *--------------------------------------
  251. ; PlayerInit
  252.  
  253.     IFD    use
  254.     IFD    Smpl
  255.     lea    Smpl,a1            ; Samples
  256.     ELSE
  257.     sub.l    a1,a1
  258.     ENDC
  259.  
  260.     IFD    SmpBuf
  261.     lea    SmpBuf,a2        ; Sample buffer
  262.     ENDC
  263.  
  264.     lea    Song,a0            ; Module
  265.     moveq    #0,d0            ; Auto Detect
  266.     move.w    _CiaTimer(pc),d1    ; indicate timer usage
  267.     bsr.w    P61_motuuli+P61_InitOffset
  268.     ENDC
  269.     
  270. *--------------------------------------
  271.  
  272.     jsr    _LVOROSWaitVBlank(a6)
  273.     lea    CopList1,a0
  274.     moveq    #COPF_COPPER1!COPF_STROBE,d0
  275.     jsr    _LVOROSSetCopper(a6)
  276.     move.w    #DMAF_SETCLR!DMAF_MASTER!DMAF_RASTER!DMAF_COPPER,d0
  277.     jsr    _LVOROSSetDMA(a6)
  278.  
  279.     lea    Inter(pc),a0
  280.     moveq    #INTB_VERTB,d0
  281.     jsr    _LVOROSSetIntVec(a6)
  282.  
  283.     move.w    #INTF_SETCLR!INTF_INTEN!INTF_VERTB,d0
  284.     IFD    use
  285.     or.w    _CiaIntFlag(pc),d0    ; start P61 int
  286.     ENDC
  287.     jsr    _LVOROSSetInt(a6)
  288.  
  289. *--------------------------------------
  290. ; Init-Routines
  291.  
  292. .Inits
  293.  
  294.  
  295. *--------------------------------------
  296. ; Main-Program
  297.  
  298. .MainLoop    
  299. ;    jsr    _LVOROSWaitVBlank(a6)
  300.  
  301.  
  302. .tstend    move.b    endflag(pc),d0
  303.     beq.b    .MainLoop
  304.  
  305. *--------------------------------------
  306.  
  307.     jsr    _LVOROSWaitVBlank(a6)
  308.     move.w    #DMAF_MASTER!DMAF_RASTER!DMAF_COPPER,d0 ; clear dma
  309.     jsr    _LVOROSSetDMA(a6)
  310.     move.w    #INTF_VERTB,d0        ; clear int
  311.     IFD    use
  312.     or.w    _CiaIntFlag(pc),d0    ; stop P61 int
  313.     ENDC
  314.     jsr    _LVOROSSetInt(a6)
  315.  
  316.     IFD    use
  317.     bsr.w    P61_motuuli+P61_EndOffset
  318.     ENDC
  319.  
  320.     jsr    _LVOROSAwakeSystem(a6)
  321. .afterawake
  322.  
  323.  
  324. .freeaudio
  325.     IFD    use
  326.     jsr    _LVOROSFreeAudio(a6)
  327.     ENDC
  328.  
  329. .closeROS
  330.     move.l    _ROSBase(pc),a1
  331.     CALLEXEC CloseLibrary
  332.  
  333. .closeint
  334.     move.l    _IntuitionBase(pc),a1
  335.     CALLEXEC CloseLibrary
  336.  
  337. .end    moveq    #0,d0
  338.     rts
  339.  
  340. *--------------------------------------
  341.  
  342. _ROSBase    dc.l    0
  343. _IntuitionBase    dc.l    0
  344.  
  345.     IFD    use
  346. _CiaTimer    dc.w    0        ; P61 timer flags
  347. _CiaIntFlag    dc.w    0
  348.     ENDC
  349.  
  350. _ROSName    ROSNAME
  351. _IntName    INTNAME
  352.  
  353. endflag        dc.b    0
  354.         even
  355.  
  356. *--------------------------------------
  357.  
  358. ExitHandler:
  359.     move.b    #1,endflag
  360.     rts
  361.  
  362.  
  363. *------------------------------------------------------------------------------
  364. ; Players
  365.  
  366.     IFD    use
  367.     INCLUDE    Player/player610.2_ROS.s ; The Player 6.1a
  368.     ENDC
  369.  
  370. *------------------------------------------------------------------------------
  371.  
  372. Inter:                    ; Level 3 Interrupt-Routine
  373. ; The routines every interrupt
  374.  
  375.  
  376.     rts
  377.  
  378. *------------------------------------------------------------------------------
  379.  
  380.  
  381.  
  382.  
  383.  
  384. *------------------------------------------------------------------------------
  385. ; Copper area
  386.  
  387.     SECTION    Copper1,DATA_C
  388.  
  389. CopList1:
  390. CopBpl    dc.w    $00e0,0000        ; bpl-pointers
  391.     dc.w    $00e2,0000
  392.     dc.w    $00e4,0000
  393.     dc.w    $00e6,0000
  394.     dc.w    $00e8,0000
  395.     dc.w    $00ea,0000
  396.     dc.w    $00ec,0000
  397.     dc.w    $00ee,0000
  398.     dc.w    $00f0,0000
  399.     dc.w    $00f2,0000
  400.     dc.w    $00f4,0000
  401.     dc.w    $00f6,0000
  402.     dc.w    $00f8,0000
  403.     dc.w    $00fa,0000
  404.     dc.w    $00fc,0000
  405.     dc.w    $00fe,0000
  406.     dc.w    $0100,Bpl<<12!$200    ; bit-plane control reg.
  407.     dc.w    $0102,$0000        ; hor-scroll
  408.     dc.w    $0104,$0010        ; sprite/gfx priority
  409.     dc.w    $01fc,$0000        ; fetch mode
  410.     dc.w    $0108,$0000        ; modolu (odd)
  411.     dc.w    $010a,$0000        ; modolu (even)
  412.     dc.w    $008e,$2c81        ; screen size
  413.     dc.w    $0090,$2cc1        ; screen size
  414.     dc.w    $0092,$0038        ; h-start
  415.     dc.w    $0094,$00d0        ; h-stop
  416. ; end of initializing, and now the user-copper-data
  417.     dc.w    $0180,$0000
  418.     dc.l    $fffffffe        ; end of copperlist
  419.  
  420.  
  421. *------------------------------------------------------------------------------
  422. ; Screen area
  423.  
  424.     SECTION    Screen1,BSS_C
  425.  
  426. Screen1    DS.B    Scr*Bpl            ; Area for Screen1
  427.  
  428.  
  429. *------------------------------------------------------------------------------
  430. ; Music area
  431.  
  432.     IFD    use
  433.  
  434.     SECTION    Music1,DATA_C    ; Chipmem for entire module or for samples
  435.                 ; Uncomment if you use separate samples
  436. ;Smpl    INCBIN    st-00:modules/p61a/smp.art
  437.  
  438.  
  439.     IFD    Smpl
  440.     SECTION    Music2,DATA    ; If separate samples, we use fast mem for song
  441.     ENDC
  442. Song    INCBIN    st-00:modules/p61a/p61.art
  443.  
  444.  
  445.     SECTION    Music3,BSS_C
  446. ;SmpBuf    DS.B    120000        ; Uncomment if you have packed samples
  447.                 ; and insert sample buffer length
  448.     ENDC
  449.  
  450. *------------------------------------------------------------------------------
  451.  
  452.     IFEQ SourceTest
  453.     printt    ""
  454.     printt    ""
  455.     printt    "Attention Workbench-Startup enabled"
  456.     printt    ""
  457.     AUTO    WO\
  458.     ENDC
  459.  
  460. *------------------------------------------------------------------------------
  461. End:                    ; The end of all shit
  462.  
  463.